<script setup>
import {ref, onMounted} from 'vue';
import { useRoute } from 'vue-router';
import http from '/src/utils/http.js';

const route=useRoute();
const id=route.params.id;

const user=ref(null)

const getUser=async()=>{
    const response=await http.get('/user/getUserById',{params:{id:id}},)
    user.value=response.data
}

onMounted(()=>{
    console.log('用户请求')
    getUser();
}
)
</script>
<template>
    <div>
        <h1>个人中心</h1>
        <div v-if="list&list.length>0">        
          <p>{{user.name}}</p>
          <p>{{user.gender}}</p>
      </div>
    </div>
</template>